import React, { Component } from 'react'
import {NavWrap} from '../Home'
import {get} from '../../utils/http'
export default class Nav extends Component {
   constructor(){
       super()
   this.state={
         data:[]
     }
   }
   async componentDidMount(){
        let result=await get('https://m.tuniu.com/travel/mapi/channel/getCmsChannelAjax?pageId=2698&cityCode=200')
        this.setState({
            data:result.data.data[1].gItems[0].mItems.splice(0,8)
        })
       // console.log(this.state.data);
        
    }
    render() {
        return (
            <NavWrap>
                <ul>
                    {
                       this.state.data.map((value,index)=>{
                       return (
                           <li key={value+index}>
                                <img src={value.adImgUrl} alt=""/>
                       <p>{value.adMainTitle}</p>
                                 </li>
                       )      
                       })
                    }                                 
                </ul>
            </NavWrap>
        )
    }
}
